package io.yuncheng.modules.sys.controller;

import java.util.Arrays;
import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.yuncheng.modules.sys.entity.SysOperationLogEntity;
import io.yuncheng.modules.sys.service.SysOperationLogService;
import io.yuncheng.common.utils.PageUtils;
import io.yuncheng.common.utils.R;



/**
 * 系统日志
 *
 * @author jared
 * @email 15721509625@163.com
 * @date 2021-01-05 21:12:05
 */
@RestController
@Api(tags = "操作日志查询")
@RequestMapping("sys/sysoperationlog")
public class SysOperationLogController {
    @Autowired
    private SysOperationLogService sysOperationLogService;

    /**
     * 列表
     */
    @PostMapping("/list")
    @ApiOperation("有效列表")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = sysOperationLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		SysOperationLogEntity sysOperationLog = sysOperationLogService.getById(id);

        return R.ok().put("sysOperationLog", sysOperationLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody SysOperationLogEntity sysOperationLog){
		sysOperationLogService.save(sysOperationLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody SysOperationLogEntity sysOperationLog){
		sysOperationLogService.updateById(sysOperationLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		sysOperationLogService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
